<template>
  <div>
      <a-modal v-model:open="myopen" 
      :title="title"
      :width="width" 
      @ok="handleOk"
      @Cancel="toClose">
         <slot></slot>
    </a-modal>
  </div>
</template>
<script setup> 
    import {defineProps,defineEmits,watch,watchEffect} from 'vue'
    import {ref} from 'vue'
  let props=defineProps(["title","width","open"])

   let myopen=ref(false);
   
  // watch(()=>props.open,(newVal)=>{
  //     console.log(newVal,"----------")
  //      myopen.value=props.open;
  // })
   watchEffect(()=>{
          console.log(props.open,"------------")
          myopen.value=props.open;
   })


  let emit=defineEmits(["sendOk","sendClose"])
  let handleOk=()=>{
      // 插件点击了确定
      emit("sendOk")
  }
  let toClose=()=>{
      emit("sendClose")
  }
</script>



